<?php
class FaqsFForm extends BaseFormAdmin{
	public function configure(){
		$this->setWidgets(array(
				'cate_id'       => new sfWidgetFormInputText(),
				'full_name'		=> new sfWidgetFormInputText(),
				'email'			=> new sfWidgetFormInputText(),
				'phone_number'	=> new sfWidgetFormInputText(),	
				'location_city_id'        	=> new sfWidgetFormDoctrineChoice(array('model' => 'LocationCities', 'query' => Doctrine_Query::create()->select('b.id, b.name')->from('LocationCities b')->orderBy('b.sort_order DESC'),'multiple' => false, 'add_empty' => __('option_select', null, 'table_list'))),
				'location_district_id'      => new sfWidgetFormInputText(),
				'title'			=> new sfWidgetFormInputText(),
				'question'       => new sfWidgetFormTextarea(),
				'answer' => new sfWidgetFormTextarea(),
				'tags'   => new sfWidgetFormInputText(),
		));

		$this->setValidators(array(
				'cate_id'        => new sfValidatorString(array('required' => false)),
				'full_name'       => new sfValidatorString(array('required' => false)),
				'email'       	=> new sfValidatorString(array('required' =>  false)),
				'phone_number'       => new sfValidatorString(array('required' => false)),
				'location_city_id'       => new sfValidatorString(array('required' => false)),
				'location_district_id'       => new sfValidatorString(array('required' => false)),
				'title'       => new sfValidatorString(array('required' => true)),
				'question'       => new sfValidatorString(array('required' => true)),
				'answer' => new sfValidatorString(array('required' => false)),
				'tags'        => new sfValidatorString(array('required' => false))
		));
		parent::configure();

		/*
		 * Setting name of form
		*/
		$this->widgetSchema->setNameFormat('Faqs[%s]');
		$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
	}
}
